package com.budwk.app.sqfwV2.controller;

import cn.dev33.satoken.annotation.SaCheckLogin;
import com.alibaba.fastjson.JSONObject;
import com.budwk.app.sqfw.models.SqfwProblemFeed;
import com.budwk.app.sqfw.vo.SqfwProblemFeedVO;
import com.budwk.app.sqfwDoc.dto.TemplateCodeUpdateDTO;
import com.budwk.app.sqfwV2.service.ProblemFeedService;
import com.budwk.starter.common.openapi.annotation.ApiDefinition;
import com.budwk.starter.common.openapi.annotation.ApiFormParams;
import com.budwk.starter.common.openapi.annotation.ApiOperation;
import com.budwk.starter.common.result.Result;
import com.budwk.starter.log.annotation.SLog;
import lombok.extern.slf4j.Slf4j;
import org.nutz.ioc.loader.annotation.Inject;
import org.nutz.ioc.loader.annotation.IocBean;
import org.nutz.mvc.annotation.At;
import org.nutz.mvc.annotation.Ok;
import org.nutz.mvc.annotation.POST;
import org.nutz.mvc.annotation.Param;

@IocBean
@At("/platform/sqfwV2/problem/feed")
@ApiDefinition(tag = "问题反馈api")
@Slf4j
public class ProblemFeedController {

    @Inject
    private ProblemFeedService problemFeedService;

    @At
    @Ok("json")
    @POST
    @ApiOperation(name = "提交数据")
    @ApiFormParams(implementation = SqfwProblemFeed.class)
    @SaCheckLogin
    public Result<?> submitData(@Param("..") SqfwProblemFeed problemFeed) {
        log.info("ProblemFeedController submitData param: {}", JSONObject.toJSONString(problemFeed));
        return Result.data(problemFeedService.submitData(problemFeed));
    }

    @At
    @Ok("json")
    @POST
    @ApiOperation(name = "分页查询")
    @ApiFormParams(implementation = SqfwProblemFeedVO.class)
    @SaCheckLogin
    public Result<?> page(@Param("..") SqfwProblemFeedVO bean) {
        return Result.data(problemFeedService.page(bean));
    }
}
